package com.bw.zg3park2212.merchant

import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.entity.MerchantEntity
import com.bw.base.entity.MerchantEntityItem
import com.bw.base.mvvm.BaseActivity
import com.bw.zg3park2212.R
import com.bw.zg3park2212.databinding.ActivityMerchantXiangBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = "/app/MerchantXiangActivity")
class MerchantXiangActivity : BaseActivity<ActivityMerchantXiangBinding,MerchantViewModel>() {

    @Autowired
    lateinit var mmm: MerchantEntityItem

    override fun intitView() {
        ARouter.getInstance().inject(this)
        binding.info=mmm

        if (mmm.status=="新建"){
            binding.merStatus.text="审核中"
            binding.merdetailGroup.visibility=View.VISIBLE
            binding.merProCircle.setTextColor( resources.getColor(R.color.color_hui))
        }else{
            binding.merStatus.text="已审核"
            binding.merdetailGroup.visibility=View.GONE
        }
        binding.merappRefause.setOnClickListener {
            viewmodel.getmerchantno(mmm.id)
        }
        binding.merappOk.setOnClickListener {
            viewmodel.getmerchantxiang(mmm.id)
        }
    }

    override fun intitData() {
        viewmodel.merchantnoSuccse.observe(this){
            ToastUtils.showLong("驳回成功")
            finish()
        }
        viewmodel.merchantxiangSuccse.observe(this){
            ToastUtils.showLong("审核成功")
            finish()
        }
    }

}